package com.xmg.redis;

import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.redisson.config.ClusterServersConfig;
import org.redisson.config.Config;

import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.TimeUnit;

/**
 * @Author: mazhongqing
 * @Date: 2021/3/10 15:17
 */
public class RedisTest {
    public static void main(String[] args) {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://192.168.3.35:6379");

        final RedissonClient client = Redisson.create(config);
        RLock lock = client.getLock("lock1");

//        try{
//            lock.lock();
//            try {
//                TimeUnit.SECONDS.sleep(300);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }finally{
//            lock.unlock();
//        }
        Objects.equals(1,2);
//        ClusterServersConfig clusterServersConfig = config.useClusterServers().addNodeAddress("123:34","345:43");
    }
}
